package com.swust.monitorProject.controller;

import com.swust.monitorProject.entity.R;
import com.swust.monitorProject.service.IDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("dept")
public class DeptController {
    @Autowired
    private IDeptService deptService;

    @PutMapping("updateCata")
    public R updateDeptCata(@RequestParam Long deptId, @RequestParam String newCata) {
        Boolean isUpdated = deptService.updateDeptCata(deptId, newCata);
        if (isUpdated) {
            return R.ok("更新成功");
        } else {
            return R.failed("更新失败");
        }
    }


}

